#ifndef POVGEOMETRY_H
#define POVGEOMETRY_H

#include <string>
#include <vector>

namespace POVGeom
{
    struct POVPoint
    {
        union
        {
            struct
            {
                float x,y,z;
            };
            float v[3];
        };
    };

    struct POVTriangle
    {
        union
        {
            POVPoint p1,p2,p3;      
            POVPoint pv[3];
        };
    };

    struct POVTexture
    {
        std::string name;
    };

    class POVMesh
    {
        protected:
            std::vector<POVTriangle>triangles;
            std::vector<POVTexture>textures;
            float rotX,rotY,rotZ;
            std::string name;
            float * vertexArray;
            void generateVertexBufferObjects();
       
            unsigned int vbufferID; //TODO change this to GLuint
            unsigned int ibufferID; //TODO change this to GLuint
        public:
            POVMesh();
            void addTriangle(POVTriangle t);
            void addTexture(POVTexture t);
            void setRotX(float r);
            void setRotY(float r);
            void setRotZ(float r);
            float getRotX(){return rotX;};
            float getRotY(){return rotY;};
            float getRotZ(){return rotZ;};

            void setName(std::string name);
            std::string getName(){return name;};
            int getNumberOfTris();
            int getVertexArray(float * va);
            void renderVBO();
    };

    class POVObject
    {
        protected:
            std::vector<POVMesh*> meshes;

        public:
            void addMesh(POVMesh * m);
            POVMesh * getMesh(int index);
            int getNumberOfMeshes(){return meshes.size();};
    };
};
#endif
